#ifndef GAMECAMERA_H_
#define GAMECAMERA_H_

#include "entity.h"

#include "util.h"

enum
{

	TARGET_ENTITY = 0,
	TARGET_POS

};

enum
{

	MOVEMENT_INSTANT = 0,
	MOVEMENT_VELOCITY,
	MOVEMENT_VELOCITYACCELERATION

};

class CGameCamera
{

private:
	
	Vector2D m_Translate;

	CEntity * m_pTargetEntity;
	Vector2D m_TargetPos;
	
	bool m_bAlwaysCentered;
	double m_FocusPadding;

	Vector2D m_CurCameraSpeed;
	double m_MaxCameraSpeed;
	double m_CameraDecel;
	double m_CameraAccel;

	bool m_bIncludeOutsideSpace;
	Vector2D m_TopLeft, m_BottomRight;

	int m_TargetType, m_MovementType;
	
	bool m_bLocked;

public:

	CGameCamera();
	
	inline void Lock()
	{
		
		m_bLocked = true;
		
	}
	
	inline void Unlock()
	{
		
		m_bLocked = false;
		
	}
	
	inline void SetTopLeftBounds( double x, double y )
	{
		
		m_TopLeft.x = x;
		m_TopLeft.y = y;
		
	}
	
	inline void SetBottomRightBounds( double x, double y )
	{
		
		m_BottomRight.x = x;
		m_BottomRight.y = y;
		
	}
	
	inline void BindCameraToEntity( CEntity * e )
	{
		
		m_pTargetEntity = e;
		m_TargetType = TARGET_ENTITY;
		
		Vector2D targetPos = e->GetPos();
		
		m_Translate.x = targetPos.x - SCREEN_WIDTH * .5;
		m_Translate.y = targetPos.y - SCREEN_HEIGHT * .5;
		
	}
	
	inline void SetCameraTranslation( float x, float y )
	{
		
		m_Translate.SetXY( x, y );
		
	}
	
	const Vector2D & GetCurTranslation()
	{
		
		return m_Translate;
		
	}
	
	void Translate( double );
	
};

#endif